//
//  ThreeCell.m
//  BeautyClother
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "ThreeCell.h"
#import "UIImageView+WebCache.h"

@interface ThreeCell ()

@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation ThreeCell

- (void)dealloc
{
    
    [_image release];
    [_name release];
    [_title release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        [self create];
        
        
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [self.title release];
        
        self.name = [[UILabel alloc]init];
        [self.contentView addSubview:self.name];
        [_name release];
        
        
    }
    return self;
}

- (void)create
{
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    
    
        UIImageView *image1 = [[UIImageView alloc]initWithFrame:CGRectMake(120 *_offWidth, 0, width - 120 *_offWidth, 300* _offHeight)];
        
        [self.contentView addSubview:image1];

    image1.tag = 100;
        [image1 release];
    UIImageView *image2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 120 *_offWidth, 150 * _offHeight)];
    image2.tag = 101;
    [self.contentView addSubview:image2];
    
    
    [image2 release];
    UIImageView *image3 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 150 * _offHeight, 120 *_offWidth, 150 * _offHeight)];
    image3.tag = 102;
    [self.contentView addSubview:image3];
    
   
    
    [image3 release];


}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    
    self.name.frame = CGRectMake(10 *_offWidth, 325 * _offHeight, self.contentView.frame.size.width - 20 *_offWidth, 40 * _offHeight);
    self.name.numberOfLines = 2;
    self.name.textColor = [UIColor lightGrayColor];
    self.name.font = [UIFont systemFontOfSize:12];
    
    self.title.frame = CGRectMake(10 *_offWidth, 305 * _offHeight, self.contentView.frame.size.width - 20 *_offWidth, 20 * _offHeight);
    _title.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.1];
   
    
    
    
}

- (void)sendPhoto:(NSArray *)array
{
    UIImageView *first = (UIImageView *)[self.contentView viewWithTag:100];
    UIImageView *second = (UIImageView *)[self.contentView viewWithTag:101];
    UIImageView *third = (UIImageView *)[self.contentView viewWithTag:102];
    
    [first sd_setImageWithURL:[NSURL URLWithString:[array objectAtIndex:0]] placeholderImage:nil];
    [second sd_setImageWithURL:[NSURL URLWithString:[array objectAtIndex:1]] placeholderImage:nil];
    [third sd_setImageWithURL:[NSURL URLWithString:[array objectAtIndex:2]] placeholderImage:nil];
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
